package com.cxhc.app.api;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.cxhc.common.utils.poi.ExcelUtil;
import com.cxhc.system.domain.app.RpIllegalPark;
import com.cxhc.system.service.app.IRpIllegalParkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cxhc.common.core.controller.BaseController;
import com.cxhc.common.core.domain.AjaxResult;
import com.cxhc.common.core.page.TableDataInfo;

/**
 * 违停检查Controller
 * 
 * @author Dhq
 * @date 2024-09-19
 */
@RestController
@RequestMapping("/api/illegalPark")
public class ApiRpIllegalPark extends BaseController
{
    @Autowired
    private IRpIllegalParkService rpIllegalParkService;

    /**
     * 查询违停检查列表
     */
    @GetMapping("/list")
    public TableDataInfo list(RpIllegalPark rpIllegalPark)
    {
        startPage();
        List<RpIllegalPark> list = rpIllegalParkService.selectRpIllegalParkList(rpIllegalPark);
        return getDataTable(list);
    }

    /**
     * 导出违停检查列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, RpIllegalPark rpIllegalPark)
    {
        List<RpIllegalPark> list = rpIllegalParkService.selectRpIllegalParkList(rpIllegalPark);
        ExcelUtil<RpIllegalPark> util = new ExcelUtil<RpIllegalPark>(RpIllegalPark.class);
        util.exportExcel(response, list, "违停检查数据");
    }

    /**
     * 获取违停检查详细信息
     */
    @GetMapping(value = "/detail/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(rpIllegalParkService.selectRpIllegalParkById(id));
    }

    /**
     * 新增违停检查
     */
    @PostMapping("/insert")
    public AjaxResult add(@RequestBody RpIllegalPark rpIllegalPark)
    {
        return toAjax(rpIllegalParkService.insertRpIllegalPark(rpIllegalPark));
    }

    /**
     * 修改违停检查
     */
    @PostMapping("/update")
    public AjaxResult edit(@RequestBody RpIllegalPark rpIllegalPark)
    {
        return toAjax(rpIllegalParkService.updateRpIllegalPark(rpIllegalPark));
    }

    /**
     * 删除违停检查
     */
    @GetMapping(value = "/delete/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(rpIllegalParkService.deleteRpIllegalParkById(id));
    }
}
